(detect_coding): Don't overflow coding->carryover.
authorKenichi Handa <handa@m17n.org>
Thu, 19 Feb 2009 04:23:32 +0000 (04:23 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 19 Feb 2009 04:23:32 +0000 (04:23 +0000)
src/coding.c

index ec57467f0230bf1b3cd5ba3d262b2755069fadac..313e4021486ef023f0c08b1fdb86fea68bc264f9 100644 (file)
@@ -6805,6 +6805,8 @@ decode_coding (coding)
             coding->carryover.  */
          unsigned char *p = coding->carryover;
 
+         if (nbytes > sizeof coding->carryover)
+           nbytes = sizeof coding->carryover;
          coding->carryover_bytes = nbytes;
          while (nbytes-- > 0)
            *p++ = *src++;